import { put } from './crud'
export function ctrlService(tid, serviceid, params, path) {
    let ctrlcmd = {
        identifier: serviceid,
        tid: tid,
        params: params,
        protocol_path: path,
    };
    return new Promise((re, rej) => {

    put("api/service", ctrlcmd, "uid=" + tid)
        .catch((err) => {
            console.log(err);
            rej(err)
            }).then((res => {
                if (res && res.data) {
                    if (res.data.result) {
                    return re(res.data.result)
                }
            }
            rej("time out")
            
        }))
    })
}
export default {
    ctrlService,
}